package com.hanscan.persistence.entities;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;


@Entity
@Table(name = "UserTypes")
@SequenceGenerator(name = "UserTypesGen", sequenceName = "UserTypesGen", allocationSize = 1)
@NamedQueries(
{
    @NamedQuery(name = "getAllUserTypes",
    query = "SELECT g FROM UserType g"),
    @NamedQuery(name = "findUserTypesByValue",
    query = "SELECT u FROM UserType u " +
    "WHERE u.userTypeValue=?1"),
    @NamedQuery(name = "findUserTypeById",
    query = "SELECT u FROM UserType u " +
    "WHERE u.id=?1")
})
public class UserType implements Serializable
{
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "UserTypesGen")
    private Integer id;
    @Column(nullable = false)
    private int userTypeValue;
    private String description;

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public int getUserTypeValue() {
        return userTypeValue;
    }

    public void setUserTypeValue(int userTypeValue) {
        this.userTypeValue = userTypeValue;
    }



    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof UserType)) {
            return false;
        }
        UserType other = (UserType) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.hanscan.persistence.entities.UserType[id=" + id + "]";
    }

}
